import request from '@/utils/request';

// 会话列表
export function chattingList(pram) {
    return request({
      url: '/admin/platform/assistant/conversation/list',
      method: 'get',
      params: pram,
    });
  }

  // 消息记录
  export function historyList(pram) {
    return request({
      url: '/admin/platform/assistant/message/list',
      method: 'get',
      params: pram,
    });
  }

  // 发送消息
  export function sendMessage(pram){
    const data = {
        content: pram.content,
        contentType: pram.contentType,
        conversationId: pram.conversationId
    };
    return request({
        url: '/admin/platform/assistant/message/send',
        method: 'POST',
        data: data,
      });
  }

  // 客服分组
  export function groupClassfly(pram) {
    return request({
      url: '/admin/platform/assistant/group/list',
      method: 'get',
      params: pram,
    });
  }

  // 客服列表
  export function groupList(pram) {
    return request({
      url: '/admin/platform/assistant/group-account/list',
      method: 'get',
      params: pram,
    });
  }

  // 客服分组修改
  export function updateClassfly(pram) {
    const data = {
      name: pram.name,
      id: pram.id,
    };
    return request({
      url: `/admin/platform/assistant/group/update`,
      method: 'POST',
      data: data,
    });
  }

   // 客服人员分组修改
   export function updateGroup(pram) {
    const data = {
      assistantGroupId: pram.assistantGroupId,
      id: pram.id,
      nickname: pram.nickname
    };
    return request({
      url: `/admin/platform/assistant/group-account/update`,
      method: 'POST',
      data: data,
    });
  }


// 结束会话
export function endChat(pram) {
  const data = {
    conversationId: pram.conversationId,
  };
  return request({
    url: `/admin/platform/assistant/conversation/complete`,
    method: 'POST',
    data: data,
  });
}

// 读消息
export function readChat(pram) {
  const data = {
    conversationId: pram.conversationId,
  };
  return request({
    url: `/admin/platform/assistant/message/read`,
    method: 'POST',
    data: data,
  });
}


// 客服设置信息
export function serviceSettingInfo(pram) {
  return request({
    url: `/admin/platform/assistant/setting/info`,
    method: 'get',
    params: pram,
  });
}  

// 更新客服设置信息
export function updateSettingInfo(pram) {
  const data = pram
  return request({
    url: `/admin/platform/assistant/setting/save`,
    method: 'POST',
    data: data,
  });
}


// 常见问题
export function getQuestion(pram) {
  return request({
    url: `/admin/platform/assistant/question/list`,
    method: 'get',
    params: pram,
  });
}

// 新增问题
export function addQuestion(pram) {
  const data = pram
  return request({
    url: `/admin/platform/assistant/question/save`,
    method: 'POST',
    data: data,
  });
}

// 编辑问题
export function editQuestion(pram) {
  const data = pram
  return request({
    url: `/admin/platform/assistant/question/update`,
    method: 'POST',
    data: data,
  });
}

// 删除问题
export function deleteQuestion(pram) {
  return request({
    url: `/admin/platform/assistant/question/delete`,
    method: 'get',
    params: pram,
  });
}

// 快捷回复
export function getReply(pram) {
  return request({
    url: `/admin/platform/assistant/quick-reply/list`,
    method: 'get',
    params: pram,
  });
}

// 新增快捷回复
export function addReply(pram) {
  const data = pram
  return request({
    url: `/admin/platform/assistant/quick-reply/save`,
    method: 'POST',
    data: data,
  });
}

// 编辑快捷回复
export function editReply(pram) {
  const data = pram
  return request({
    url: `/admin/platform/assistant/quick-reply/update`,
    method: 'POST',
    data: data,
  });
}

// 删除快捷回复
export function deleteReply(pram) {
  return request({
    url: `/admin/platform/assistant/quick-reply/delete`,
    method: 'get',
    params: pram,
  });
}

// 历史会话
export function getChattingHistory(pram){
  return request({
    url: `/admin/platform/assistant/conversation/history/list`,
    method: 'get',
    params: pram,
  });
}

// 会话转接
export function transferChat(pram){
  const data = pram
  return request({
    url: `/admin/platform/assistant/conversation-transfer/transfer`,
    method: 'POST',
    data: data,
  });
}

// 指定会话的消息列表
export function getChatByOne(pram){
  return request({
    url: `/admin/platform/assistant/message/list/conversation`,
    method: 'get',
    params: pram,
  });
}

// 盘点任务列表
export function stocktakingList(pram) {
  return request({
    url: `/admin/platform/stocktaking/task/page`,
    method: 'get',
    params: pram,
  });
}

// 删除盘点任务
export function stocktakingDel(pram) {
  return request({
    url: `/admin/platform/stocktaking/task/delete`,
    method: 'get',
    params: pram,
  });
}

// 作废盘点任务
export function stocktakingUpdata(pram) {
  return request({
    url: `/admin/platform/stocktaking/task/delete`,
    method: 'get',
    params: pram,
  });
}

// 盘点任务详情
export function stocktakingDetail(pram) {
  return request({
    url: `/admin/platform/stocktaking/task/info`,
    method: 'get',
    params: pram,
  });
}

// 生成盘点任务
export function stocktakingAdd(pram){
  const data = pram
  return request({
    url: `/admin/platform/stocktaking/task/add`,
    method: 'POST',
    data: data,
  });
}


// 盘点预览
export function stocktakingPreview(pram) {
  return request({
    url: `/admin/platform/stocktaking/task/detail/preview/list`,
    method: 'get',
    params: pram,
  });
}

// 即时库存分页列表
export function jishiList(pram) {
  return request({
    url: `/admin/platform/warehouse/current/inventory/summary/page`,
    method: 'get',
    params: pram,
  });
}

export function platformData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/data/overview`,
    method: 'POST',
    data: data,
  });
}

export function backData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/buy/back`,
    method: 'POST',
    data: data,
  });
}

export function saleData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/sale/trend`,
    method: 'POST',
    data: data,
  });
}

export function chargeData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/recharge/trend`,
    method: 'POST',
    data: data,
  });
}

export function durationData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/delivery/duration`,
    method: 'POST',
    data: data,
  });
}

export function distanceData(pram){
  const data = pram
  return request({
    url: `/admin/platform/statistics/home/delivery/distance`,
    method: 'POST',
    data: data,
  });
}






































